using NodeCanvas.Variables;
using UnityEngine;

namespace NodeCanvas.Actions
{
	[Category("✫ Blackboard")]
	[AgentType(typeof(Blackboard))]
	public class SetAnyBlackboardVariable : ActionTask
	{
		[RequiredField]
		public string targetVariableName;

		[SerializeField]
		private BBVariableSet variableSet = new BBVariableSet();

		protected override string info
		{
			get
			{
				return string.Format("<b>'${0}'</b> = {1}", targetVariableName, (variableSet.selectedBBVariable == null) ? string.Empty : variableSet.selectedBBVariable.ToString());
			}
		}

		protected override void OnExecute()
		{
			(base.agent as Blackboard).SetDataValue(targetVariableName, variableSet.objectValue);
			EndAction();
		}
	}
}
